package com.rongji.dfish.hello.dao;

import com.rongji.dfish.framework.hibernate5.dao.impl.FrameworkDao4Hibernate;
import com.rongji.dfish.hello.entity.SysOrg;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class OrgDao extends FrameworkDao4Hibernate<SysOrg, String> {

    public List<SysOrg> listChildren(String parent, String orgStatus) {
        // 不做空指针
        return queryForList("SELECT t FROM SysOrg t WHERE t.orgParent=? AND t.orgStatus=?", new Object[]{parent, orgStatus});
    }

    public int updateStatus(String orgId, String orgStatus) {
        // 非空判断
        return bulkUpdate("UPDATE SysOrg t SET t.orgStatus=? WHERE t.orgId=?", new Object[]{orgStatus, orgId});
    }

}
